package cn.kshost.zqyg.exception;
import cn.kshost.zqyg.model.vo.common.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class ZqygExceptionHandler {
    @ExceptionHandler(value = Exception.class)
    public Result<Object> exceptionHandler(Exception e) {
        System.err.println(e.getMessage());
        return Result.build(null,201,e.getMessage());
    }

    @ExceptionHandler(ZhongQiaoException.class)
    public Result<Object> zhongQiaoExceptionHandler(ZhongQiaoException e) {
        return Result.build(null,e.getResultCodeEnum());
    }
}
